package com.sfx.controller;

import org.springframework.beans.factory.BeanNameAware;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

public class BeanLifeComponent implements BeanNameAware {
    @Override
    public void setBeanName(String s) {
        System.out.println("执行通知方法 " + s);
        StringBuilder stringBuilder = new StringBuilder();
    }

    @PostConstruct
    public void postConstruct(){
        System.out.println("执行postConstruct方法!!!");
    }

    /**
     * XML中指定的方法
     */
    public void init_method(){
        System.out.println("执行初始化方法!!!");
    }

    public void use(){
        System.out.println("使用Bean ");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("执行销毁方法");
    }
}
